<template>
  <div class="header">
    <div class="logo">API管理平台</div>
    <div class="user-info">
      管理员, {{username}}
      <el-link type="primary" @click="logout">[ 安全退出 ]</el-link>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      username: window.sessionStorage.getItem('username')
    }
  },
  methods: {
    logout () {
      window.sessionStorage.clear()
      this.$router.push('/login')
    }
  }
}
</script>
<style lang="scss" scoped>
.header {
  background-color: #24262D;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .logo {
    color: #C5C6C8;
    margin-left: 20px;
  }
  .user-info {
    color: #fff;
    margin-right: 20px;
  }
}
</style>
